## ==============helm 安装 docke 镜像源修改 ============

export namespace="argoproj-system"
export app_name="argocd"
# export repo="argoproj"
export repo="bitnami"
export helm="$repo/argo-cd"
export url="https://argoproj.github.io/argo-helm"
export CLEARPASSWORD="youling790313"

# export argocdtag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | jq -r '.tag_name')
# export tag="v2.6.0-rc2" #v2.6.0-rc2 latest

# helm repo remove $repo
# helm repo add $repo $url
# helm repo update $repo

helm upgrade --create-namespace --install --devel \
  -n $namespace $app_name $helm \
  --set config.secret.argocdServerAdminPassword=${CLEARPASSWORD} \
  --set server.ingress.enabled=true \
  --set server.ingress.ingressClassName="higress" \
  --set server.ingress.hostname="argocd.youling.io"
# -f values.yaml

## 编辑 argocd-server Deployment 以将 --insecure 标志添加到 argocd-server 命令中
# containers:
#         - name: server
#           image: argoproj/argocd:v2.5.0
#           args:
#             - /usr/local/bin/argocd-server
#             - '--insecure'

# env:
#   - name: TZ
#     value: "Asia/Shanghai"

#获取管理员密码
# kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

# kubectl create namespace argocd
# kubectl apply -n argocd -f https://ghproxy.net/https://raw.githubusercontent.com/argoproj/argo-cd/refs/heads/master/manifests/install.yaml

#高可用性安装
# kubectl create namespace argocd
# kubectl apply -n argocd -f https://ghproxy.net/https://raw.githubusercontent.com/argoproj/argo-cd/refs/heads/master/manifests/ha/install.yaml
# kubectl apply -f ./cloud-devops/argocd/ingress-argocd.yaml
